package io.jee.runshan.service.impl;

import io.jee.medusa.remote.RemoteConnector;
import io.jee.medusa.vo.ResultBean;
import io.jee.runshan.domain.remote.weixin.WeixinKfAccount;
import io.jee.runshan.domain.remote.weixin.WeixinResponse;
import io.jee.runshan.service.ICustomerService;
import io.jee.runshan.utils.JsonUtil;
import io.jee.runshan.utils.WeixinConstant;

import java.util.List;

import javax.transaction.Transactional;

import org.springframework.stereotype.Service;

@Service
@Transactional
public class CustomerServiceImpl implements ICustomerService {
	private static final String AddKfAccountUrl = "customservice/kfaccount/add";

	@Override
	public ResultBean<WeixinResponse> addKfAccount(WeixinKfAccount kfAccount) {
		kfAccount.setKf_account("ynshun");
		kfAccount.setNickname("顺子");
		kfAccount.setPassword("yns0222.");
		String url = WeixinConstant.sendUrl(AddKfAccountUrl);
		String json = JsonUtil.beanToJson(kfAccount);
		WeixinResponse response = RemoteConnector.post(url, json, WeixinResponse.class);
		return ResultBean.result(true, WeixinConstant.getProperty(response.getErrcode()), response);
	}

	@Override
	public ResultBean<WeixinResponse> updateKfAccount(WeixinKfAccount account) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public ResultBean<WeixinResponse> delKfAccount(WeixinKfAccount account) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public ResultBean<List<WeixinKfAccount>> getKfList() {
		// TODO Auto-generated method stub
		return null;
	}

}
